<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<input type="button" value="开灯" id="btn">
	<script>
	function my$(id){
		return document.getElementById(id);
	}
	
	var isOpen = true;
	my$('btn').onclick = function(){
		if(isOpen){
			document.body.style.backgroundColor = 'tan'
			this.value = '开灯';
			isOpen = false;
		}else{
			document.body.style.backgroundColor = 'orange'
			this.value = '关灯';
			isOpen = true;
		}
	}
	</script>
</body>
</html>